<template>
  <div id="SamstoSampleStorageIn">
    <breadcrumb content="标本销毁" />
    <div class="bodyContent">
      <Splitpanes class="area" click>
        <Pane size="70">
          <el-tabs type="border-card">
            <el-tab-pane label="待销毁标本">
              <LabSampleDistory ref="labSampleDistoryRef" :currentRow="curSelectRow" @findList="findList" @clickCell="clickCell" @addCell="addMethod" />
            </el-tab-pane>
          </el-tabs>
        </Pane>
        <Pane size="30">
          <div class="bankContent">
            <el-tabs type="border-card" v-model="activeName">
              <el-tab-pane label="标本盒信息" name="infoForm">
                <SamstoDistorySelect ref="samstoDistorySelectRef" :currentRow="curSelectRow"  @toggleSelectRow="toggleSelectRow" @findList="findList" />
              </el-tab-pane>
            </el-tabs>
          </div>
        </Pane>
      </Splitpanes>
    </div>
  </div>
</template>

<script lang="ts" setup>
// 引入组件区 ==========
import Breadcrumb from '@/components/Breadcrumb.vue'; //面包屑
import { reactive, ref, getCurrentInstance, onMounted, watch } from 'vue';
import { Splitpanes, Pane } from 'splitpanes';
import { AppStore } from '@/stores/store';
import SamstoDistorySelect from "./form/SamstoDistorySelect.vue";
import LabSampleDistory from "./list/LabSampleDistory.vue";
import LabSampleProcessStayScanInStore from "./list/LabSampleProcessStayScanInStore.vue";
import { IsEmpty } from '@/utils/common';
let store = AppStore();

// 全局变量定义区 ==========
let { proxy }: any = getCurrentInstance();

// 左侧表格:
const curSelectRow = ref({});
const isPageDisabled = ref(true);
// 右侧表单:
const labSampleDistoryRef = ref<InstanceType<typeof LabSampleProcessStayInStore>>(); //基本信息表单标记ref
const LabSampleProcessStayScanInStoreRef = ref(null);
const samstoDistorySelectRef = ref<InstanceType<typeof SamstoSpecboxInSelect>>(); //基本信息表单标记ref
const activeName = ref('infoForm');
const infoTabPaneDisabled = ref(true);
const activeNameRK = ref('first');
watch(curSelectRow, (newValue, oldValue) => {
  if (!IsEmpty(newValue.id)) {
    isPageDisabled.value = false;
    infoTabPaneDisabled.value = false;
  } else {
    activeName.value = "infoList";
    isPageDisabled.value = true;
    infoTabPaneDisabled.value = true;
  }
});
// 方法定义区 =============
onMounted(() => {
});
// 表格选中当前行
function clickCell(rows: any) {
  selectItemRows(rows);
}
// 表格选中当前行
async function toggleSelectRow(row: any) {
  labSampleDistoryRef.value?.toggleSelectRow(row);
}
// 新增
async function addMethod() {

  // proxy.$emit('addCell');
  // activeName.value="infoForm";
}
//选中行后传值给FORM
async function selectItemRows(rows) {
  samstoDistorySelectRef.value?.selectSpecboxOrder(rows);
}
</script>
<style lang="scss" scoped>
#SamstoSampleStorageIn {
  width: 100%;
  height: 100%;
  .bodyContent {
    // 面包屑40px  上下间距10px
    height: calc(100% - 60px);
    .area {
      background-color: $base-white;
      // 附加按钮间距
      .button-blue,
      .button-red {
        margin: 5px 0 5px 5px;
      }
      .tableBox {
        height: calc(100% - 40px);
      }
      .el-tabs {
        border: none;
        height: 100%;
        :deep(.el-tabs__content) {
          padding: 0;
          height: calc(100% - 39px);
          .el-tab-pane {
            height: 100%;
          }
          #pane-0 {
            padding: 15px;
            height: calc(100% - 30px);
          }
        }
      }
    }
    .bankItemContent {
      min-height: 600px;
      border-radius: 10px;
    }

    .disabled {
      pointer-events: none;
      opacity: 0.5;
    }
  }
}
</style>
